﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MS.InformationManagement.Core.Support;
using Office = Microsoft.Office.DocumentManagement.DocumentSets;
using MS.InformationManagement.Support.Constants;
using MS.InformationManagement.Support;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Taxonomy;

namespace MS.InformationManagement.BLL.CaptureModule
{
    public class UpdateCapturedItemCommand : IBaseCommand
    {

        #region Fields

        Office.DocumentSet _currentDocument;
        DateTime _logTime;
        string _currentUser;

        #endregion

        #region Constructors

        public UpdateCapturedItemCommand(Office.DocumentSet currentDocument, string currentUser)
        {
            _currentDocument = currentDocument;
            _currentUser = currentUser;

        }

        #endregion

        public void Execute()
        {
            _logTime = DateTime.Now;
            _currentDocument.Log(string.Empty, _logTime, Support.Enums.TraceableOperation.Digitalizado, _currentUser, string.Empty);
        }

        public void Undo()
        {
            _currentDocument.RemoveLog(_logTime);
            _currentDocument.Item.Update();
        }
    }
}
